home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / util / wb / remember.lha / Remember.p < prev    next >
Text File  |  1998-04-01  |  8KB  |  219 lines

  1. ; Remember 1.0
  2. ; (c) 1998 Cyborg 
  3.  
  4.     {* Include sys:coder/preass/Options.p *}
  5.     {* Include sys:coder/preass/Prozeduren.p *}
  6.     {* String: Version="$VER: Remember 1.0 30.3.98 (C) CYBORG 98"*}
  7.     {* IncBlock: Readynamen,1024*}
  8.     {* IncBlock: Backupnamen,1024*}
  9.     {* Include sources:Remember.fenster*}
  10.     {* IncVar: Name2,Name1,AppMessage*}
  11.     {* String: Portname="Remember"*}
  12.  
  13. PortUp[]:
  14.     movem.l a0-a3,-(sp)
  15.     cport=createmsgport()
  16.     addport(cport)
  17.     move.l cport,a0
  18.     lea 10(a0),a0
  19.     move.l #Portname,(a0)
  20.     movem.l (sp)+,a0-a3
  21.     RTS
  22.  
  23. PortDown[]:
  24.     movem.l a0-a3,-(sp)
  25.     RemPort(cPort)
  26.     deletemsgport(cport)
  27.     movem.l (sp)+,a0-a3
  28.     RTS
  29.  
  30. Printname[]:
  31.     Taskname=.l10(Task)
  32.     Bytes=Countstring(Taskname)
  33.     Write(OH,Taskname,Bytes)
  34.     Write(OH,"\n",1)
  35.     RTS
  36.  
  37. PrintTasks[Task]:
  38.     Task=.l0(Task)
  39.     If Task##0 {
  40.                  Printname()
  41.                  bra PrintTasks
  42.                }
  43.     RTS
  44.  
  45. PrintTasknames[]:
  46.     Waiting=406(Execbase)
  47.     Ready=420(Execbase)
  48.     Write(OH,"\nReady-Tasks\n-----------\n",?)
  49.     PrintTasks(Ready)
  50.     Write(OH,"\nWait-Tasks\n----------\n",?)
  51.     PrintTasks(Waiting)
  52.     RTS
  53.  
  54. GetTasknames[]:
  55.     Task=420(Execbase)
  56.     Lea Readynamen,a5
  57. .GetTasknames1:
  58.     Task=.l0(Task)
  59.     Taskname=.l10(Task)
  60.     If Task##0 {
  61.                  move.l Taskname,(a5)+
  62.                  bra .GetTasknames1
  63.                }
  64.     Task=406(Execbase)
  65. .GetTasknames2:
  66.     Task=.l0(Task)
  67.     Taskname=.l10(Task)
  68.     If Task##0 {
  69.                  move.l Taskname,(a5)+
  70.                  bra .GetTasknames2
  71.                }
  72.     move.l #0,(a5)+
  73.     RTS
  74.  
  75. VergleicheTaskzeiger[]:
  76.     Lea Readynamen,a0
  77.     Lea Backupnamen,a1
  78. .l1:move.l (a0)+,d0
  79.     cmpi.l #0,d0
  80.     beq .OK
  81.     Lea Backupnamen,a1
  82. .l2:cmpi.l #0,(a1)
  83.     beq .error
  84.     cmpi.l (a1)+,d0
  85.     bne .l2
  86.     bra .l1
  87. .error:
  88.     moveq.l #0,d0
  89.     RTS
  90. .ok:
  91.     moveq.l #-1,d0
  92.     RTS
  93.  
  94. WriteStrings[]:
  95.     lea Readynamen,a5
  96.     move.l #255,d6                                         
  97. .l1:move.l (a5)+,a4
  98.     cmpi.l #0,a4
  99.     beq .l2
  100.     bytes=Countstring(a4)
  101.     Write(FH,A4,Bytes)
  102.     Write(FH,"\n",1)
  103.     bra .l1
  104. .l2:RTS
  105.  
  106. HideMode:
  107.     GetTasknames()
  108.     Copymem(#Readynamen,#Backupnamen,1024)
  109. .Schleife:
  110.     Delay(50)
  111.     GetTasknames()
  112.     If VergleicheTaskzeiger()=#0 {
  113.                                    Result=DrawGuia(Gui,0)
  114.                                    Copymem(#Readynamen,#Backupnamen,1024)
  115.                                    If (FH=Open("Envarc:Remember.dump",#Mode_new))##0 {
  116.                                                                                        WriteStrings()
  117.                                                                                        Close(FH)
  118.                                                                                      }
  119.                                  }
  120.     
  121.     bra .Schleife    
  122.  
  123. Start:
  124.     OH=Output()
  125.     GetFilename()
  126.     If Filename=#"HIDE" --> Hidemode
  127. ;    PrintTasknames()
  128.     PortUp()
  129.     If (DiskObj=GetDiskObject("ProgDir:Remember"))=#0 --> PDown
  130.     If (AppIcon=AddAppIconA(0,0,"Remember",Cport,0,DiskObj,0))=#0 --> FDisk
  131.     GetTasknames()
  132.     Copymem(#Readynamen,#Backupnamen,1024)
  133. OWin:
  134.     If Window##0 --> WaitMessage
  135.     If Open_window()=#0 --> RICON
  136.     If Create_Gadgets()##0 --> closewindow
  137. WaitMessage:
  138.     For I=0 To 50
  139.         Delay(10)
  140.         GuiGadgetActionA(Gui,>GetTags:GEG_GetVar,GEG_Allgadgets|Tag_done,Null)
  141.         If (Msg=GetMsg(Cport))##0 {
  142.                                     move.l Msg,a0
  143.                                     Moveq.l #0,d0
  144.                                     lea 18(a0),a0
  145.                                     move.w (a0)+,d0
  146.                                     add.l d0,a0
  147.                                     move.l a0,AppMessage
  148.                                     AM_Type=.w0(AppMessage)
  149.                                     AM_NumArgs=.l10(AppMessage)
  150.                                     AM_ArgList=.l14(AppMessage)
  151.                                     If AM_Type##8 and AM_Type##7 --> WaitMessage
  152.                                     If AM_Numargs=#0 and AM_Arglist=#0 --> OWIN
  153.                                     Anzahl==AM_NumArgs
  154.                                     ArgList==AM_Arglist
  155.                                     ReplyMsg(Msg)
  156.                                     Bra OWin
  157.                                   }
  158.         If Window##0 and (Msg=GetGuiMsg(Gui))##0 { 
  159.                                  MsgClass=.l36(Gui)
  160.                                  MsgGadNbr=.w52(Gui)
  161.                                  If MsgClass=#IDCMP_CloseWindow {
  162.                                                                   jsr Close_window
  163.                                                                   bra WaitMessage
  164.                                                                 }
  165.                                  GuiGadgetActionA(Gui,#GetTags)
  166.                                  If MsgGadNbr=#1 {
  167.                                                    move.l name1,d0
  168.                                                    swap d0
  169.                                                    andi.l #$FFFF,d0
  170.                                                    muls.l #4,d0
  171.                                                    lea Readynamen,a0
  172.                                                    add.l d0,a0
  173.                                                    move.l (a0),Name2
  174.                                                    Bytes=Countstring(Name2)
  175.                                                    Result=Countstring(#befehlsstring)
  176.                                                    If (FH=Open("envarc:Remember.tasks",#Mode_Old))##0 {
  177.                                                                                                          Seek(FH,0,#Offset_End)
  178.                                                                                                          Write(FH,Name2,Bytes)
  179.                                                                                                          Write(FH,"\n",1)
  180.                                                                                                          Write(FH,#Befehlsstring,Result)
  181.                                                                                                          Write(FH,"\n",1)
  182.                                                                                                          Close(FH)
  183.                                                                                                        }
  184.                                                  }
  185.                                  If MsgGadNbr=#3 --> CloseWindow
  186.                                }
  187.     Next I
  188. Remember:
  189.     GetTasknames()
  190.     If VergleicheTaskzeiger()=#0 {
  191.                                    If Window##0 {
  192.                                                   Result=DrawGuia(Gui,0)
  193.                                                 }
  194.                                    Copymem(#Readynamen,#Backupnamen,1024)
  195.                                    If (FH=Open("Envarc:Remember.dump",#Mode_new))##0 {
  196.                                                                                        WriteStrings()
  197.                                                                                        Close(FH)
  198.                                                                                      }
  199.                                  }
  200.     
  201.     bra WaitMessage
  202. Closewindow:
  203.     Close_window()
  204. RIcon:
  205.     If AppIcon##0 {
  206.                     RemoveAppIcon(AppIcon)
  207.                   }
  208. FDisk:
  209.     FreeDiskObject(DiskObj)
  210. Pdown:
  211.     If (OK=GetMsg(Cport))##0 {
  212.                                ReplyMsg(OK)
  213.                                Bra Pdown
  214.                              }
  215.     PortDown()
  216. ende:
  217.     RTS
  218.